import { defineStore } from 'pinia'
const useCardsStore = defineStore('cards', {
  state: () => ({
    cards: [] as Wx.Card.Data[],
    diys: [] as Wx.Card.Data[],
    filterCards: [] as Wx.Card.Data[],
  }),
  getters: {
    getCards(): Wx.Card.Data[] {
      return this.cards
    },
    getDiy(): Wx.Card.Data[] {
      return this.diys
    },
  },
  actions: {
    setCards(cards: Wx.Card.Data[]) {
      this.cards = cards
      this.setFilterCards(cards)
    },
    setDiys(diys: Wx.Card.Data[]) {
      this.diys = diys
    },
    setFilterCards(cards: Wx.Card.Data[]) {
      this.filterCards = cards
    },
  },
})

export default useCardsStore
